/**
 * @Title: skipViewLink_directive.js
 * @Description: TODO
 * Copyright: Copyright (c) 2014 
 * Company:中国平安
 *
 * @Project HIMS-FWA
 * @author QIANDUO875
 * @date 2014年9月28日 上午11:07:53
 * @version V1.0
 */
;
(function(){
	'use strict';
	
	var app = angular.module('fwa.directives');
	app.directive('skipViewLink', ['$state',function($state){
		
		var Type_Org = 'org',
			Type_Region = 'region',
			Type_Depart = 'depart';
			
		var tempMap = {
			org:'settleAnalyse.orgView',
			region:'settleAnalyse.regionView',
			depart:'settleAnalyse.departView'
		};
		
		function link($scope, $elem, $attrs) {
			if($scope.data.type) {
				$elem.click(function(e){
					$state.go(tempMap[$scope.data.type],{id:$scope.data.id,doctor:'',dept:'',orgCode:$scope.data.orgCode||''});
					$scope.$apply();
				});
			}
		}
		
		return {
			restrict: 'A',
			scope:false,
			link:link
		};
		
	}]);
	
})();